package com.attcatstudy.Thread;

import java.util.concurrent.locks.LockSupport;

/**
 * @author attcat
 * ---做一个有趣的程序员
 * @date 2022-10-31 21:46
 * @description
 */
public class LockSupportTest {
    public static void main(String[] args) throws InterruptedException {
        Thread a=new Thread(new  Runnable(){
            @Override
            public void run() {
                System.out.println("ParkThread开始执行");
                LockSupport.park();//等待“许可
                System.out.println("ParkThread执行完成");
            }
        });
        a.start();
        Thread.sleep(1000);
        LockSupport.unpark(a);//给A许可
    }
}
